package com.hxx.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hxx.entity.StationEntity;
import com.hxx.mapper.StationMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hxx.service.StationService;

@Service
public class StationServiceImpl extends ServiceImpl<StationMapper, StationEntity>
        implements StationService {
    @Autowired
    private StationMapper stationMapper;
    @Override
    public Page<StationEntity> listPage(Page<StationEntity> page,
                                        StationEntity entity) {
        return stationMapper.selectPage(page, new LambdaQueryWrapper<StationEntity>()
                .like(entity.getName() != null, StationEntity::getName, entity.getName())
                .like(entity.getNamePinyin() != null, StationEntity::getNamePinyin, entity.getNamePinyin())
                .like(entity.getNamePy() != null, StationEntity::getNamePy, entity.getNamePy())
        );
    }
}
